home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / comm / irc / KuangEleven3Gm.lha / Kuang Eleven 3 / Rexx / Kuang11CMD.AMIRX < prev    next >
Text File  |  1998-05-22  |  29KB  |  1,149 lines

  1. /* $VER: kuang11cmd.amirx 3.4 (21.5.98) Kuang Eleven commands
  2. */
  3. /* Away/Back sounds */
  4. backsnd='Back.WAV'
  5. awaysnd='Away.WAV'
  6.  
  7. /* WallChops/WallNops Prefix.%c replaced with channel*/
  8. wcpr='['x2c(2)'WChOp/%c'x2c(2)']'
  9. wnpr='['x2c(2)'WNOps/%c'x2c(2)']'
  10.  
  11. /* Default away reason if no Awayreason file is found */
  12. defaultaway='Making Coffee'
  13.  
  14.  
  15. /* DO NOT TOUCH BODY OF SCRIPT BELOW ! */
  16. signal on syntax
  17. options results
  18. if ~show('L','rexxdossupport.library') then if ~addlib('rexxdossupport.library',0,-30,2) then do
  19.     cecho('Kuang11','Fatal Error: Cannot load rexxdossupport.library')
  20.     exit
  21. end
  22. if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do
  23.     cecho('Kuang11','Fatal Error: Cannot load rexxsupport.library')
  24.     exit
  25. end
  26. bell=x2c('07');div=x2c('01');parse UPPER VERSION ver;freq=substr(word(ver,6),1,2)
  27. parse arg command args
  28. upper command
  29. Select
  30.     when command='ACHAN' then achan()
  31.     when command='REALL' then reall()
  32.     when command='VOTE' then vote()
  33.     when command='AWAY' then away()
  34.     when command='SHOW' then showlog()
  35.     when command='XDCC' then xdcc()
  36.     when command='PC' then pc()
  37.     when command='CYCLE' then cycle()
  38.     when command='CHOPS' then wchops()
  39.     when command='IKICK' then ikick()
  40.     when command='KB'|command='BK' then kb()
  41.     when command='SKICK' then skick()
  42.     when command='NFDEOP' then nfdeop()
  43.     when command='PBAN' then pban()
  44.     when command='J' then join()
  45.     when command='VOTETST' then votetst()
  46.     when command='KIGN' then ig()
  47.     when command='KUNG' then noig()
  48.     when command='AMSG' then amsg()
  49.     when command='NOPS' then wnops()
  50.     when command='KDCC' then kdcc()
  51.     when command='GETXDCC' then getxdcc()
  52.     when command='KBAN' then timeban()
  53.     when command='RESOLVE' then resolve()
  54.     otherwise
  55.         pr='KHelp'
  56.         cecho(pr,und(bld('Kuang Eleven Command')))
  57.         cecho(pr,'Usage: /kx [KEYWORD] [ARGUMENTS]')
  58.         cecho(pr,'AWAY <Reason> - Toggle Away Also : /Away and /Back')
  59.         cecho(pr,'VOTE - Kuang Lamuh Vote')
  60.         cecho(pr,'IKICK - Kick with making channel Invite briefly')
  61.         cecho(pr,'SKICK - Speak Kick')
  62.         cecho(pr,'KBAN  - Ban with many options')
  63.         cecho(pr,'CHOPS - Write notice to All CHannel OPerators')
  64.         cecho(pr,'NOPS - Write notice to all non-channel operators')
  65.         cecho(pr,'XDCC - XDCC Server Also : /XDCC')
  66.         cecho(pr,'GETXDCC - Auto request and get an XDCC pack from someone')
  67.  
  68. end
  69. exit
  70. resolve:
  71. pr='Resolve'
  72. parse var args nick .
  73. if nick=''|nick='?' then do
  74.     cecho(pr,'Usage : /RESOLVE [Nick]|[IP]')
  75.     exit
  76. end
  77. cecho(pr,'disabled')
  78. exit
  79. if pos('.',nick)=0 then do
  80.     nick=gethost(nick)
  81.     parse var nick . '@' nick .
  82. end
  83. ip=getnumip(nick)
  84. cecho(pr,'Numeric ip for' bld(nick) ':' bld(ip))
  85. exit
  86.  
  87. kdcc:
  88. rts()
  89. pr='KDCC'
  90. parse var args nick .
  91. if nick=''|nick='?' then do
  92.     cecho(pr,'Usage : /KDCC [Nick]')
  93.     exit
  94. end
  95. dir=rtfilerequest(,,'Pick files to be packed...',,'rtfi_flags = freqf_multiselect' tags,files)
  96. if dir='' then exit
  97. sz=0
  98. "GETPROGDIR"
  99. progdir=addpart(result,'')
  100. list=''
  101. do i=1 to files.count
  102.     if pos(':',files.i)=0 then files.i=progdir||files.i
  103.     if ~exists(files.i) then do
  104.         cecho(pr,'File' files.i 'does not exist!')
  105.         exit
  106.     end
  107.     files.i=strip(files.i,'B','"')
  108.     list=list '"'files.i'"'
  109.     sz=sz+word(statef(files.i),2)
  110. end
  111. list=strip(list)
  112. cmp=getclip('sc_allwaycompresswith')
  113. if cmp='' then cmp=rtezrequest('What compressor to use?'||NL||'Allways ZIP/LHA will make this requester go away.','Lha|Zip|Lzx|Allways Lha|Allways Zip|Allways Lzx|Abort','Kuang Eleven KDCC',tags)
  114. Select
  115.     when cmp=0 then exit
  116.     when cmp=1 then cmp='LHA'
  117.     when cmp=2 then cmp='ZIP'
  118.     when cmp=3 then cmp='LZX'
  119.     when cmp=4 then do
  120.         cmp='LHA'
  121.         call setclip('sc_allwaycompresswith','LHA')
  122.     end
  123.     when cmp=5 then do
  124.         cmp='ZIP'
  125.         call setclip('sc_allwaycompresswith','ZIP')
  126.     end
  127.     when cmp=6 then do
  128.         cmp='LZX'
  129.         call setclip('sc_allwaycompresswith','LZX')
  130.     end
  131. otherwise
  132. cmp='LHA'
  133. end
  134. Select
  135.     when cmp='LHA' then archive=files.1||'.lha'
  136.     when cmp='ZIP' then archive=files.1||'.zip'
  137.     when cmp='LZX' then archive=files.1||'.lzx'
  138. otherwise
  139. cecho(pr,'Error')
  140. exit
  141. end
  142. if left(archive,9)='Ram Disk:' then archive='RAM:'substr(archive,10)
  143. do while exists(archive)
  144.     archive=pathpart(archive)'_'filepart(archive)
  145. end
  146. Select
  147.     when cmp='LHA' then address command 'lha -qa a "'archive'"' list
  148.     when cmp='ZIP' then address command 'zip -q "'archive'"' list
  149.     when cmp='LZX' then address command 'lzx -qa a "'archive'"' list
  150. otherwise
  151. cecho(pr,'Error')
  152. exit
  153. end
  154.  
  155. if ~exists(archive) then do
  156.     cecho(pr,'Unable to create archive' archive)
  157.     exit
  158. end
  159. nsz=word(statef(archive),2)
  160. cecho(pr,'Sending pack' bld(filepart(archive)) 'to' bld(nick)'.Original:'bld(trunc(sz/1000,1))'K Compressed:'bld(trunc(nsz/1000,1))'K Ratio :'trunc((nsz/sz)*100)'%')
  161. div='01'x
  162. 'RAW PRIVMSG' nick ':'div||'KDCC' '"'filepart(archive)'"'||div
  163. call setclip('st_kdcc',getclip('st_kdcc') archive' '||'01'x)
  164. 'SAY /DCC SEND' nick '"'archive'"'
  165. exit
  166.  
  167. getxdcc:
  168. parse var args nick pack .
  169. pr='XDCCGet'
  170. if nick='' then do
  171.     cecho(pr,'Usage : /AXDCC [NICK] <PACK>')
  172.     exit
  173. end
  174. nick=resnick(nick)
  175. div=x2c('01');n=1
  176. if pack=''|~datatype(pack,'W') then do
  177.     rts()
  178.     do until pack~=''
  179.         str=''
  180.         do i=n to n+3
  181.             str=str||i'|'
  182.         end
  183.         pack=rtezrequest("Select Pack Number",str"List|More|Abort","XDCCGet",tags)
  184.         if pack=0 then exit
  185.         if pack=5 then list=1
  186.         if pack=6 then do
  187.             pack=''
  188.             n=n+4
  189.         end
  190.     end
  191.     if list=1 then str='LIST'
  192.     else do
  193.         pack=pack+n-1
  194.         str='SEND #'pack
  195.     end
  196. end
  197. else str='SEND #'pack
  198. 'RAW PRIVMSG' nick ':'div||'XDCC' str||div
  199. if list~=1 then do
  200.     if getclip('st_init')~='1' then cecho(pr,'Kuang Eleven not active - unable to DCC Autoget')
  201.     else do
  202.         /* Temp Autoget code */
  203.         call setclip('st_autoget',strip(getclip('st_autoget') ':'upper(nick)))
  204.         cecho(pr,'Activating temporary DCC Autoget from' nick)
  205.     end
  206. end
  207. if list=1 then cecho(pr,'Requested Packs list from' nick)
  208. else cecho(pr,'Requested Pack' pack 'from' nick)
  209. exit
  210.  
  211.  
  212. away:
  213. "GETAWAYSTATE"
  214. if rc=5 then do
  215. /* going BACK */
  216.     if ~readargs(args,'QUIET=Q/S,VERBOSE=V/S,ALL/S,SHOW/S,BULLSHIT/F')|bullshit='?' then do
  217.         cecho('Back','Usage : QUIET=Q/S,VERBOSE=V/S,ALL/S,SHOW/S')
  218.         exit
  219.     end
  220.  
  221.     call setclip('st_awayt')
  222.     str='is back.'
  223.     snd=backsnd
  224.     call geta
  225.     call setclip('st_backstr',str)
  226.     call setclip('st_backcmd',cmd)
  227.  
  228.     if all then call getports
  229.     else ports=address()
  230.  
  231.     do port=1 to words(ports) until ~all
  232.         address value word(ports,port)
  233.         "GETAWAYSTATE"
  234.         if rc=5 then do
  235.             call setclip('st_awayargs'right(address(),1),args)
  236.             'RAW AWAY'
  237.         end
  238.     end
  239. end
  240. else do
  241.     /* GOING AWAY */
  242.     reason=''
  243.     if ~readargs(args,'QUIET=Q/S,VERBOSE=V/S,HIDE/S,ALL/S,REASON/F')|reason='?' then do
  244.         cecho('Away','Usage : QUIET=Q/S,VERBOSE=V/S,HIDE/S,ALL/S,REASON/F')
  245.         exit
  246.     end
  247.     if reason=''|datatype(reason,'W') then reason=getreason(reason)
  248.  
  249.     disp=getclip('sc_awayverb')
  250.     log=getclip('sc_log')
  251.     if log=='' then log='OFF'
  252.     page=getclip('sc_page')
  253.     if page=='' then page='OFF'
  254.     s=' Log['log'] Page['page']'
  255.  
  256.     awnick=getclip('sc_awaynick')
  257.     if disp='ON' then str='->'reason'<-';else str=reason
  258.  
  259.     awayecho=str||s
  260.  
  261.     if disp='ON' then str=str||s
  262.     str='is away' str
  263.     if page='ON' then do
  264.         if awnick='' then mnick=getnick();else mnick=awnick
  265.         s=s '/CTCP' mnick 'PAGE'
  266.     end
  267.     awaystr=reason s
  268.  
  269.     /*call setclip('st_awayt',date('i') time('s'))*/
  270.     if getclip('sc_aicon')=='ON' then hide=1
  271.     snd=awaysnd
  272.  
  273.     if hide&show('P',KUANG) then address KUANG HIDE
  274.     if all then call getports
  275.     else ports=address()
  276.  
  277.     call geta
  278.  
  279.     do port=1 to words(ports) until ~all
  280.         address value word(ports,port)
  281.         portvalue=right(address(),1)
  282.         "GETAWAYSTATE"
  283.         if rc~=5 then do
  284.             call setclip('st_awayecho'portvalue,awayecho)
  285.             call setclip('st_awaystr'portvalue,str)
  286.             call setclip('st_awaycmd'portvalue,cmd)
  287.             call setclip('st_awayargs'portvalue,args)
  288.             'RAW AWAY :'awaystr
  289.         end
  290.     end
  291. end
  292. exit
  293. geta:
  294. a=getclip('sc_awaytxt')
  295. Select
  296.     when quiet then str=''
  297.     when verbose|a='TEXT'|a='ON' then do
  298.         cmd='/ME' str
  299.         str=div||'ACTION' str||div
  300.     end
  301.     when a='SOUND' then do
  302.         str=div||'SOUND' snd||div
  303.         cmd='/SOUND' snd
  304.     end
  305.     when a='BOTH' then do
  306.         cmd='/SOUND' snd str
  307.         str=div||'SOUND' snd str||div
  308.     end
  309. otherwise
  310.     str=''
  311. end
  312. return
  313.  
  314. getports:
  315. l=show('P');ports='';p=0
  316. do forever
  317.     p=pos('AMIRC.',l,p+1)
  318.     if p=0 then leave
  319.     ports=ports substr(l,p,7)
  320. end
  321. return
  322.  
  323. getreason: PROCEDURE EXPOSE defaultaway
  324. if ~open(1,'Kuang11/AwayReasons','R') then return defaultaway
  325. msgs=readch(1,65535);cr='0a'x
  326. close(1)
  327. amsg.='';i=0
  328. do until msgs=''
  329.     parse var msgs msg (cr) msgs
  330.     if msg='' then leave
  331.     i=i+1
  332.     amsg.i=msg
  333. end
  334. if i=0 then return defaultaway
  335. if datatype(arg(1),'W') then return value('amsg.'min(i,max(1,arg(1))))
  336. return value('amsg.'random(1,i,time('s')))
  337.  
  338.  
  339. /* ## Shared functions here
  340. */
  341. notice:;'QueueRAW NOTICE' arg(1) ':'arg(2);return 0
  342. toggle:;t='sc_'||lower(arg(1));if getclip(t)='ON' then x='OFF';else x='ON';call setclip(t,x);return '['bld(x)']'
  343. cecho:;"ECHO P="d2c(27)"b«"arg(1)"» TEXT="arg(2)'.';return 0
  344. vecho:;"ECHO P="d2c(27)"b«Kuang11» TEXT="und(arg(1)||':') arg(2)'.';return 0
  345. me:;'QueueRAW PRIVMSG' arg(1) ':'||div||'ACTION' arg(2)||div;return 0
  346. sayc:;'QueueRAW NOTICE' arg(1) ':'arg(2);return 0
  347. chans:;"CHANNELS";return result
  348. getnick:;"GETMYNICK";return result
  349. getchan:;"GETCHANNEL";return result
  350. getserv:;"GETSERVERNAME";return result
  351. getusr:;"GETUSERS";return result
  352. userdomain: PROCEDURE;ip=arg(1);if datatype(compress(ip,'.'),'n') then return substr(ip,1,pos('.',ip,pos('.',ip)+1)-1)||'*';pi=translate(strip(lower(reverse(ip))),' ','.');w=words(pi);if w<3 then return ip;do i=3 to w;  if ~datatype(word(pi,i),'L') then leave;end;return '*'||translate(reverse(delword(pi,i)),'.',' ')
  353. ison:;if pos(upper(arg(1))' ',upper(getusr())' ')~==0 then return 1;else return 0
  354. gethost: "USERHOST" arg(1);return result
  355. uexists: if pos('@',gethost(arg(1)))~==0 then return 1;else return 0
  356. kick:;'RAW KICK' arg(1) arg(2) ':'arg(3);return 0
  357. mod:;'RAW MODE' channel arg(1);return 0
  358. amrx:;'SAY /RX' arg(1);return 0
  359. ply:
  360. if getclip('sc_playsounds')~=='ON' then return 0
  361. 'PLAYSOUND _K11'arg(1)'.snd'
  362. return 0
  363. prsprg:PROCEDURE
  364. X=addpart(ARG(1),'')
  365. "GETPROGDIR"
  366. Y=RESULT
  367. IF UPPER(LEFT(X,8))='PROGDIR:' THEN RETURN addpart(Y,'')||SUBSTR(X,9)
  368. RETURN X
  369.  
  370. rts:
  371. if ~show('L','rexxreqtools.library') then if ~addlib('rexxreqtools.library',0,-30,0) then do
  372.     cecho('Error','Cannot load rexxreqtools.library')
  373.     exit
  374. end
  375. "INFO screen"
  376. tags='rt_pubscrname="'result'" rt_reqpos=reqpos_pointer'
  377. NL = '0a'x
  378. return 0
  379. resnick:PROCEDURE
  380. tnick=arg(1)
  381. Select
  382. when pos('@',tnick)~=0 then do
  383.     "GETSELECTEDUSER"
  384.     tnick=result
  385. end
  386. when pos('*',tnick)~=0 then do
  387.     "GETUSERS"
  388.     users=compress(result,'@+')
  389.     nix='';upper tnick
  390.     do until users=''
  391.         parse var users nick users
  392.         "MATCHUSERHOST" nick'!*@*' tnick'*!*@*'
  393.         if rc=1 then nix=nix nick
  394.     end
  395.     tnick=strip(nix)
  396.     if tnick='' then do
  397.         cecho('MatchNick','Unable to match')
  398.         exit
  399.     end
  400.     if words(tnick)>1 then do
  401.         cecho('MatchNick','Multiple nicks found :' tnick)
  402.         exit
  403.     end
  404. end
  405. otherwise
  406. end
  407. return tnick
  408. syntax:
  409. l=rc
  410. 'echo You have found a bug! report the lines below by E-Mail to Me at amagnum@bigfoot.com'
  411. 'echo Command :' command 'Arguments :' args
  412. 'echo' l ':' errortext(l)
  413. 'echo' SIGL ':' sourceline(SIGL)
  414. call setclip('st_wchop')
  415. exit
  416. /*## Commands functions here
  417. */
  418.  
  419. reall:
  420. "GETUSERS"
  421. x="Re" translate(compress(result,"@+"),","," ")
  422. do until x=''|length(x)=1
  423. p=min(length(x),150)
  424. parse var x y =p x
  425. "SAY" y
  426. end
  427. exit
  428.  
  429. achan:
  430. 'SAY /msg' translate(chans(),',',' ') args
  431. exit
  432.  
  433. ig:
  434. pr='KIgnore'
  435. if args='' then do
  436.     cecho(pr,'Usage: /KX KING [NICK] {CTCP|PRIV|TEXT}')
  437.     exit
  438. end
  439. parse var args nick f
  440. f=strip(f)
  441. nick=resnick(nick)
  442. if ~uexists(nick) then do
  443.     cecho(pr,'Nick' bld(nick) 'not found')
  444.     exit
  445. end
  446. if f='' then f='CTCP PRIV'
  447. host=gethost(nick)
  448. 'SAY /IGNORE *!*@'substr(host,pos('@',host)+1) f
  449. exit
  450.  
  451. noig:
  452. pr='KUnIgnore'
  453. if args='' then do
  454.     cecho(pr,'Usage: /KX KUNG [NICK]')
  455.     exit
  456. end
  457. nick=resnick(strip(args))
  458. if ~uexists(nick) then do
  459.     cecho(pr,'Nick' bld(nick) 'not found')
  460.     exit
  461. end
  462. host=gethost(nick)
  463. 'SAY /UNIGNORE *!*@'substr(host,pos('@',host)+1)
  464. exit
  465.  
  466. join:
  467. args=strip(args)
  468. if args='' then do
  469.     cecho('Join','Specify Channel,no '#' required')
  470.     exit
  471. end
  472. if substr(args,1,1)~=='#' then args='#'args
  473. 'SAY /JOIN' args
  474. exit
  475.  
  476. skick:
  477. pr='SpeakKick'
  478. if args='' then do
  479.     cecho(pr,'Usage: /SKICK [NICK] [TIME] (in seconds)')
  480.     exit
  481. end
  482. parse var args nk t .
  483. if ~datatype(t,'W') then do
  484.     vecho(pr,'Invalid arguments')
  485.     exit
  486. end
  487. nk=resnick(nk)
  488. if ~ison(nk) then do
  489.     vecho(pr,bld(nk) 'is not on channel')
  490.     exit
  491. end
  492. if t>0 then do
  493.     call setclip('st_skickt')
  494.     nku=upper(nk)
  495.     call setclip('st_skick',nku)
  496.     'SAY /HILITE' nk
  497.     'SAY /ME Sets Speak Kick on' bld(nk) 'for' t 'seconds'
  498.     notice(nk,'You are not allowed to speak for' t 'seconds!')
  499.     cecho(pr,'/Skick' nk '0 to remove prematurely')
  500.     do t
  501.         call delay(freq)
  502.         if getclip('st_skick')~==nku then exit
  503.     end
  504. end
  505. 'SAY /UNHILITE' nk
  506. call setclip('st_skick')
  507. call setclip('st_skickt')
  508. 'SAY /ME Removes Speak Kick from' bld(nk)
  509. notice(nk,'You may now speak!')
  510. exit
  511.  
  512.  
  513. timeban:
  514. pr='KBan';time=0;reason=''
  515. if ~readargs(args,'NICK/A,DOM/S,PERM/S,TIME/N,REASON/F')|nick='?'|nick='' then do
  516.     cecho(pr,'Usage : /KBan NICK/A,DOM/S,PERM/S,TIME/N,REASON/F')
  517.     cecho(pr,'DOM - set ban as *!*@*.domain otherwise set as *!*user@*domain')
  518.     cecho(pr,'PERM - Add to friends list with b flag')
  519.     cecho(pr,'TIME - Optional,is in second')
  520.     exit
  521. end
  522. n=resnick(nick)
  523. host=gethost(n)
  524. channel=getchan()
  525. if ~ison(n) then do
  526.     cecho(pr,'Unknown Nick' bld(n))
  527.     exit
  528. end
  529. if dom then ip='*!*@'userdomain(substr(host,pos('@',host)+1))
  530. else ip='*!*'strip(substr(host,1,pos('@',host)),'L',' ~+')||userdomain(substr(host,pos('@',host)+1))
  531. if time~=0 then reason=strip('Banned for' time 'seconds:'reason)
  532. if perm then 'SAY /ADDF' n 'b' ip
  533. mod('-o+b' n ip)
  534. kick(channel,n,reason)
  535. if time='0'|time='' then exit
  536. call delay(time*freq)
  537. if perm then 'SAY /DELF' n
  538. mod('-b' ip)
  539. exit
  540.  
  541.  
  542. ikick:
  543. parse var args n r
  544. n=resnick(n)
  545. if ~ison(n) then do
  546.     cecho('InviteKick',bld(n) 'is not on channel')
  547.     exit
  548. end
  549. channel=getchan()
  550. if r='' then r='[Kuang Eleven]'
  551. mod('+i')
  552. kick(channel,n,r)
  553. call delay(6*freq)
  554. mod('-i')
  555. exit
  556.  
  557.  
  558. vote:
  559. pr='LAmuhVotE'
  560. v=getclip('st_vote')
  561. if args='' then do
  562.     if v~='' then do
  563.         r=getclip('st_voteres')
  564.         cecho(pr,bld(word(r,1)) 'Kicks' bld(word(r,2)) 'KickBans' bld(word(r,3)) 'Stays')
  565.     end
  566.     else cecho(pr,'Usage :  /VOTE [NICK]|[COUNT]|[UPDATE]|[CANCEL]')
  567.     exit
  568. end
  569. args=strip(args)
  570. com=upper(args)
  571. select
  572. when com='CANCEL' then do
  573.     if v='' then do
  574.         cecho(pr,'No vote started')
  575.         exit
  576.     end
  577.     call setclip('st_vote')
  578.     call setclip('st_votenix')
  579.     call setclip('st_voteres')
  580.     cecho(pr,'Vote on' v 'cancelled' )
  581.     'SAY' bld('Vote on' v und('cancelled')'!')
  582. end
  583. when com='COUNT' then do
  584.     if v='' then do
  585.         cecho(pr,'No vote started')
  586.         exit
  587.     end
  588.     call setclip('st_vote')
  589.     call setclip('st_votenix')
  590.     r=getclip('st_voteres')
  591.     call setclip('st_voteres')
  592.     parse var r k b s
  593.     'say' und(bld('K¹¹ Voting on' v 'Complete..'))
  594.     'SAY' k 'kicks'
  595.     'SAY' b 'ban/kicks'
  596.     'SAY' s 'stays'
  597.     channel=getchan()
  598.     Select
  599.         when b>k&b>s then do
  600.             'SAY' channel 'has decided to ban/kick' bld(v)
  601.             'SAY /KICKBAN' v bld('The people have spoken!')
  602.         end
  603.         when k+b>s then do
  604.             'SAY' channel 'has decided to kick' bld(v)
  605.             kick(channel,v,'The people have spoken!')
  606.         end
  607.         otherwise
  608.         'SAY' channel 'has decided to leave' bld(v) 'alone.'
  609.     end
  610.     exit
  611. end
  612. when com='UPDATE' then do
  613.     if v='' then do
  614.         cecho(pr,'No vote started')
  615.         exit
  616.     end
  617.     'say' bld(und('K¹¹ lamah voting!') '- Voting on' v)
  618.     r=getclip('st_voteres')
  619.     parse var r k b s
  620.     Select
  621.         when b>k&b>s then 'SAY Right now it looks like' bld(v) 'is gonna get bankicked!'
  622.         when k+b>s then 'SAY Right now it looks like' bld(v) 'is gonna get kicked!'
  623.         when k=b&b=s then 'SAY Right now the vote is tied.'
  624.         otherwise
  625.         'SAY Right now it looks like' bld(v) 'will be spared...'
  626.     end
  627.     exit
  628. end
  629. when ~ison(args) then cecho(pr,bld(args) 'is not on channel')
  630. otherwise
  631.     args=resnick(args)
  632.     call setclip('st_vote',args)
  633.     call setclip('st_voteres','0 0 0')
  634.     call setclip('st_votenix')
  635.     cecho(pr,'New Vote on' bld(args) 'started')
  636.     mynick=getnick()
  637.     'say' bld(und('K¹¹ lamah voting!') '- Voting on' args)
  638.     'say If you think' bld(args) 'should be kicked,' bld('/msg' mynick 'K')
  639.     'say If you think' bld(args) 'should be ban/kicked,' bld('/msg' mynick 'BK')
  640.     'say If you think we should leave' bld(args) 'alone,' bld('/msg' mynick 'S')
  641.     'SAY' bld('...Do not vote more than once.')
  642.     cecho(pr,'/VOTE COUNT to count vote')
  643.     cecho(pr,'/VOTE UPDATE to display an update')
  644.     cecho(pr,'/VOTE CANCEL to abort')
  645. end
  646. exit
  647.  
  648. votetst:
  649. parse var args nick t .
  650. upper t
  651. pr='LAmuhVotE'
  652. nx=getclip('st_votenix')
  653. nk=' '||upper(nick)||' '
  654. if pos(nk,nx)~=0 then do
  655.     notice(nick,'You have voted already')
  656.     kick(getchan(),nick,'Voted twice')
  657.     cecho(pr,bld(nick) 'voted twice')
  658.     exit
  659. end
  660. r=getclip('st_voteres')
  661. parse var r k b s
  662. Select
  663.     when t='K' then do
  664.         k=k+1
  665.         t='Kick'
  666.     end
  667.     when t='BK'|t='KB' then do
  668.         b=b+1
  669.         t='KickBan'
  670.     end
  671. otherwise
  672.     s=s+1
  673.     t='Stay'
  674. end
  675. notice(nick,'Thanx for voting to' t getclip('st_vote')'..')
  676. cecho(pr,bld(nick) 'voted' bld(t))
  677. cecho(pr,'Kicks:'bld(k) 'KickBans:'bld(b) 'Stays:'bld(s))
  678. call setclip('st_voteres',k b s)
  679. call setclip('st_votenix',nx||nk)
  680. exit
  681.  
  682.  
  683. XDCC:
  684. pr='XDCC'
  685. parse var args command nick spec
  686. command=upper(command)
  687. xdcc=getclip('sc_xdcc')
  688. Select
  689.     when command='PLIST' then do
  690.         if xdcc~='ON' then xdccs()
  691.         amrx('kuang11XDCC 1 pxdcc LIST .' nick)
  692.     end
  693.     when command='SLIST' then do
  694.         if xdcc~='ON' then xdccs()
  695.         amrx('kuang11XDCC 0 pxdcc LIST .' nick)
  696.     end
  697.     when command='LIST' then amrx('kuang11XDCC 1 xdcc LIST .' nick)
  698.     when command='VLIST' then amrx('kuang11XDCC 1 vxdcc LIST .' nick)
  699.     when command='XDCC' then xdccs()
  700.     when command='SEC' then sec()
  701.     when command='KICK' then xdcckick()
  702.     when command='MASSK' then xdccm()
  703.     when command='LEECH' then xdccl()
  704.     when command='RATE'|command='RATES' then xdccrate()
  705.     when command='STYLE' then xstyle()
  706.     when command='XSLOT'|command='XSLOTS'|command='SLOTS'|command='SLOT' then xslot()
  707.     when command='ADDP' then addp()
  708.     when command='DELP' then delp()
  709.     when command='NOTI' then do
  710.         if xdcc~='ON' then xdccs()
  711.         amrx('kuang11xdcc 1 noti LIST dummy')
  712.     end
  713.     when command='ANOTI' then anoti()
  714.     when command='QUEUE'|command='QUE' then call queue()
  715.     when command='SEND'|command='MOVE' then amrx('kuang11XDCC 1 local' command resnick(nick) spec)
  716.     when command='DELQ' then call delq()
  717.     when command='ANSI' then xansi()
  718.     when command='FLIST' then flist()
  719.     otherwise
  720.     px='/XDCC '
  721.     cecho(pr,und(bld('Commands')))
  722.     cecho(pr,px'LIST <N> - To View the list.')
  723.     cecho(pr,px'VLIST <N> - To View the list in verbose format.')
  724.     cecho(pr,px'PLIST <N> - To display the list to current channel.')
  725.     cecho(pr,px'SLIST <N> - To display only unsecured packs to the current channel.')
  726.     cecho(pr,px'NOTI - To send a short notify to the channel.')
  727.     cecho(pr,px'ANOTI [TIME] <MSG>- To autosend notification to current channel.')
  728.     cecho(pr,px'SEND|MOVE [NICK] [N] - To dcc send/move pack N to NICK.')
  729.     cecho(pr,px'ADDP - To add a pack.')
  730.     cecho(pr,px'DELP [N]|[ALL] - To delete pack N or ALL packs.')
  731.     cecho(pr,px'QUEUE - Displays queue list')
  732.     cecho(pr,px'DELQ [N] - Abort queue')
  733.     cecho(pr,und(bld('Configuration')))
  734.     cecho(pr,px'XDCC - Enable/Disable XDCC' wt('xdcc'))
  735.     cecho(pr,px'SEC - Global Sec' wt('xdccsec'))
  736.     cecho(pr,px'KICK - Kick Unregistered requests' wt('xdcckick'))
  737.     cecho(pr,px'MASSK - Kick on MassXdcc' wt('xdcc_masskick'))
  738.     cecho(pr,px'SLOTS [N] - XDCC Slots' wt('xdccslots'))
  739.     cecho(pr,px'LEECH Dont allow leeching.' wt('xdccleech'))
  740.     cecho(pr,und(bld('Style')))
  741.     cecho(pr,px'RATES - Display rates' wt('xdccrates'))
  742.     cecho(pr,px'STYLE - XDCC ANSI Style' wt('xdccstyle'))
  743.     cecho(pr,px'ANSI - Use Bold/Underline' wt('xdccbold'))
  744.     cecho(pr,px'FLIST - DCC''s packs list in a file ' wt('xdcc_send_filelist'))
  745. end
  746. exit
  747. xslot:
  748. pr='XDCCSlots'
  749. x=getclip('sc_xdccslots')
  750. if ~datatype(nick,'W') then cecho(pr,'Usage : /kc XSLOT [N]')
  751. else do
  752.     call setclip('sc_xdccslots',nick)
  753.     x=nick
  754. end
  755. cecho(pr,'Currently set to' bld(x))
  756. exit
  757.  
  758.  
  759. xdccl:
  760. x=getclip('sc_xdccleech')
  761. select
  762.     when x='OFF'|x=''|x='ON' then x='ALL'
  763.     when x='ALL' then x='FRIENDS'
  764.     when x='FRIENDS' then x='ALLFRIENDS'
  765. otherwise
  766.     x='OFF'
  767. end
  768. call setclip('sc_xdccleech',x)
  769. vecho('XDCC Anti-Leech',x)
  770. exit
  771.  
  772. sec:
  773. x=getclip('sc_xdccsec')
  774. select
  775.     when x='OFF'|x=''|x='ON' then x='OPS'
  776.     when x='OPS' then x='PACKS'
  777.     when x='PACKS' then x='ALL'
  778. otherwise
  779.     x='OFF'
  780. end
  781. call setclip('sc_xdccsec',x)
  782. cecho('XDCCSec','['bld(x)']')
  783. exit
  784. xstyle:
  785. x=getclip('sc_xdccstyle')
  786. if x='LONG' then x='SHORT';else x='LONG'
  787. call setclip('sc_xdccstyle',x)
  788. cecho('XDCCStyle','['bld(x)']')
  789. exit
  790. xansi:;cecho('XDCCANSI',toggle('xdccbold'));exit
  791. xdcckick:;cecho('XDCCKick',toggle('xdcckick'));exit
  792. xdccrate:;cecho('XDCCRates',toggle('xdccrates'));exit
  793. xdccs:;cecho('XDCC',toggle('xdcc'));return 0
  794. xdccm:;vecho('Kick Mass XDCC List',toggle('xdcc_masskick'));exit
  795. flist:;cecho('ListFile',toggle('xdcc_send_filelist'));return 0
  796.  
  797. wt:;return '['bld(getclip('sc_'||lower(arg(1))))']'
  798. halt:
  799. if getclip('sc_xdcca')~='' then do
  800.     call setclip('sc_xdcca')
  801.     cecho(pr,'Stopped AutoNotifying')
  802. end
  803. if getclip('st_amsg')~='' then do
  804.     call setclip('st_amsg')
  805.     cecho(pr,'Stopped AutoMessaging')
  806. end
  807. exit
  808.  
  809. queue:
  810. l=strip(getclip('st_xdccq'))
  811. if l='' then cecho(pr,'No queued requests')
  812. else do
  813.     cecho(pr,und('Queue list:'))
  814.     do i=1 to words(l)
  815.         r=word(l,i)
  816.         parse var r nk'@'pack'@'com'@'files'@'port .
  817.         cecho(pr,'<'bld(i)'> Pack' pack com 'to' nk files 'file(s) on port' port )
  818.     end
  819. end
  820. exit
  821.  
  822. delq:
  823. parse var args . q .
  824. if q='' then do
  825.     cecho(pr,'Usage : /XDCC DELQ [N]|[ALL] - Number of queue or ALL')
  826.     exit
  827. end
  828. clip='st_xdccq'
  829. if q='ALL' then do
  830.     call setclip(clip)
  831.     cecho(pr,'Aborted all queues')
  832.     exit
  833. end
  834. x=getclip(clip)
  835. if words(x)<q then do
  836.     cecho(pr,'No such queue')
  837.     call queue()
  838. end
  839. call setclip(clip,strip(delword(x,q,1)))
  840. cecho(pr,'Queued request' q 'aborted.')
  841. exit
  842.  
  843. anoti:
  844. clip='st_xdcca'right(address(),1)
  845. parse var args . time msg
  846. msg=strip(msg)
  847. if upper(time)='STOP' then do
  848.     call setclip(clip)
  849.     cecho(pr,'Signaled AutoNotify to Stop in next 10 seconds')
  850.     exit
  851. end
  852. clist=getclip(clip)
  853. nclist=words(clist)
  854. if nclist=0&~datatype(time,'W') then do
  855.     cecho(pr,'Usage : /XDCC ANOTI [TIME]|[STOP] [MESSAGE] (time in minutes)')
  856.     exit
  857. end
  858. if getclip('sc_xdcc')~='ON' then xdccs()
  859. chan=getchan()
  860. if clist='' then clist=time
  861. else if find(upper(clist),upper(chan))~=0 then do
  862.     cecho(pr,'Channel' bld(chan) 'is already AutoNotified')
  863.     exit
  864. end
  865. call setclip(clip,clist chan)
  866. cecho(pr,'Started AutoNotifying on channel' bld(chan) 'every' bld(time) 'minutes')
  867. cecho(pr,'/XDCC ANOTI STOP to Stop AutoNotify')
  868. if nclist>0 then exit
  869. signal on halt
  870. do until getclip(clip)=''
  871.     c=getclip(clip)
  872.     parse var c time c
  873.     td=3000*time;chans=upper(chans());cd='';t=0
  874.     do i=1 to words(c)
  875.         channel=word(c,i)
  876.         if find(chans,upper(channel))=0 then cecho(pr,'Stopped AutoNotifying on Channel' bld(channel))
  877.         else do
  878.             cd=cd channel
  879.             if msg~='' then sayc(channel,msg)
  880.         end
  881.     end
  882.     cd=strip(cd)
  883.     if cd='' then leave
  884.     if cd~=c then call setclip(clip,time cd)
  885.     amrx('kuang11xdcc 1 noti LIST')
  886.     cecho(pr,'Sent AutoNotify to' bld(cd) '['bld(time)']')
  887.     do until t=td|getclip(clip)=''
  888.         call delay(10*freq)
  889.         t=t+10*freq
  890.     end
  891.     if getclip('sc_xdcc')~='ON' then leave
  892.     do 30
  893.         "ISCONNECTED"
  894.         if rc==0 then leave
  895.         call delay(60*freq)
  896.         cecho(pr,'Not connected...delaying')
  897.     end
  898. end
  899. call setclip(clip)
  900. cecho(pr,'Stopped AutoNotify')
  901. exit
  902.  
  903. amsg:
  904. pr='AutoMSG'
  905. clip='st_amsg'right(address(),1)
  906. parse var args time msg
  907. msg=strip(msg)
  908. if upper(time)='STOP' then do
  909.     call setclip(clip)
  910.     cecho(pr,'Signaled AutoMessage to Stop in next 10 seconds')
  911.     exit
  912. end
  913. clist=getclip(clip)
  914. nclist=words(clist)
  915. if nclist=0&(~datatype(time,'W')|msg='') then do
  916.     cecho(pr,'Usage : /AMSG [TIME]|[STOP] [MESSAGE] (time in minutes)')
  917.     exit
  918. end
  919. chan=getchan()
  920. if clist='' then clist=time
  921. else if find(upper(clist),upper(chan))~=0 then do
  922.     cecho(pr,'Channel' bld(chan) 'is already AutoMessaged')
  923.     exit
  924. end
  925. call setclip(clip,clist chan)
  926. cecho(pr,'Started AutoMessaging on channel' bld(chan) 'every' bld(time) 'minutes')
  927. cecho(pr,'/AMSG STOP to Stop AutoMessage')
  928. if nclist>0 then exit
  929. signal on halt
  930. do until getclip(clip)=''
  931.     c=getclip(clip)
  932.     parse var c time c
  933.     td=3000*time;chans=upper(chans());cd='';t=0
  934.     do i=1 to words(c)
  935.         channel=word(c,i)
  936.         if find(chans,upper(channel))=0 then cecho(pr,'Stopped AutoMessage on Channel' bld(channel))
  937.         else do
  938.             cd=cd channel
  939.             sayc(channel,msg)
  940.         end
  941.     end
  942.     cd=strip(cd)
  943.     if cd~=c then call setclip(clip,time cd)
  944.     cecho(pr,'Sent AutoMessage to' bld(cd) '['bld(time)']')
  945.     do until t=td|getclip(clip)=''
  946.         call delay(10*freq)
  947.         t=t+10*freq
  948.     end
  949.     do 30
  950.         "ISCONNECTED"
  951.         if rc==0 then leave
  952.         call delay(60*freq)
  953.         cecho(pr,'Not connected...delaying')
  954.     end
  955. end
  956. cecho(pr,'Stopped AutoMessage')
  957. exit
  958.  
  959. addp:
  960. rts()
  961. dir=rtfilerequest(,,'Pick files for pack...',,'rtfi_flags = freqf_multiselect' tags,files)
  962. if dir='' then exit
  963. sz=0
  964. "GETPROGDIR"
  965. progdir=addpart(result,'')
  966. do i=1 to files.count
  967.     if pos(':',files.i)=0 then files.i=progdir||files.i
  968.     if ~exists(files.i) then do
  969.         cecho(pr,'File' files.i 'does not exist!')
  970.         exit
  971.     end
  972.     sz=sz+word(statef(files.i),2)
  973. end
  974. desc=strip(rtgetstring(exdiz(dir),'Enter Pack Description:','Kuang Eleven XDCC',,tags,))
  975. if rtresult=0 then exit
  976. if getclip('sc_xdccrates')='ON' then rate=rtezrequest("Select Rate:","5 Star|4 Star|3 Star|2 Star|1 Star|X-R8D|Cancel",'Kuang Eleven XDCC',tags)
  977. else rate=1
  978. if rate=0 then exit
  979. if rate=6 then rate='X-R8D';else rate=copies('-',rate-1)copies('*',6-rate)
  980. sec=rtezrequest("Select Sec:","OFF|O_N|Cancel",'Kuang Eleven XDCC',tags)
  981. if sec=0 then exit
  982. sec=sec-1
  983. if sz>1000000 then do
  984.     do until datatype(mcps,'W')
  985.         mcps=strip(rtgetstring('0','Enter Minimum required CPS value:'||NL||'0 to disable','Kuang Eleven XDCC',,tags,))
  986.     end
  987.     if rtresult=0 then exit
  988. end
  989. else mcps=0
  990. f='kuang11/XDCC'
  991. if exists(f) then m='A';else m='W'
  992. if ~open(1,f,m) then do
  993.     cecho(pr,'Unable to write' f)
  994.     exit
  995. end
  996. writeln(1,'#')
  997. do i=1 to files.count
  998.     writeln(1,'`'files.i)
  999. end
  1000. writeln(1,desc)
  1001. writeln(1,trunc(sz/1000) rate sec mcps)
  1002. close(1)
  1003. call setclip('st_xdccbank')
  1004. cecho(pr,'Added Pack Ok' desc)
  1005. exit
  1006.  
  1007. delp:
  1008. f='kuang11/XDCC'
  1009. if upper(nick)='ALL' then do
  1010.     if exists(f) then do
  1011.         delete(f)
  1012.         call setclip('st_xdccbank')
  1013.     end
  1014.     cecho(pr,'XDCC bank has been emptied!')
  1015.     exit
  1016. end
  1017. if ~datatype(nick,'w') then do
  1018.     cecho(pr,'Invalid Pack Specified')
  1019.     exit
  1020. end
  1021. if nick<1 then do
  1022.     cecho(pr,'Invalid Pack Specified')
  1023.     exit
  1024. end
  1025. if ~exists(f) then do
  1026.     cecho(pr,'No packs in XDCC Bank')
  1027.     exit
  1028. end
  1029. if ~open(1,f,'r') then do
  1030.     cecho(pr,'Error : Unable to open' f)
  1031.     exit
  1032. end
  1033. cr=x2c('0a')
  1034. x='';i=0;pack.=0
  1035. do until eof(1)
  1036.     y=strip(readln(1))
  1037.     if y~='' then do
  1038.         if y='#' then do
  1039.             i=i+1
  1040.             pack.i=length(x)+1
  1041.         end
  1042.         x=x||y||cr
  1043.     end
  1044. end
  1045. close(1)
  1046. if nick>i then do
  1047.     cecho(pr,'Invalid Pack Specified')
  1048.     exit
  1049. end
  1050. if i=1 then do
  1051.     delete(f)
  1052.     cecho(pr,'XDCC bank has been emptied!')
  1053.     exit
  1054. end
  1055. if nick=i then  x=delstr(x,pack.nick)
  1056. else do
  1057.     y=nick+1
  1058.     x=delstr(x,pack.nick,pack.y-pack.nick)
  1059. end
  1060. if ~open(1,f,'w') then do
  1061.     cecho(pr,'Unable to write' f)
  1062.     exit
  1063. end
  1064. writech(1,x)
  1065. close(1)
  1066. call setclip('st_xdccbank')
  1067. cecho(pr,'Deleted pack' nick 'Ok')
  1068. exit
  1069.  
  1070. exdiz: PROCEDURE
  1071. fn=arg(1)
  1072. if exists('t:file_id.diz') then delete('t:file_id.diz')
  1073. p=lastpos('.',fn)
  1074. psn=max(lastpos('/',fn),pos(':',fn))+1
  1075. if p=0 then return substr(fn,psn)
  1076. ext=upper(substr(fn,p))
  1077. Select
  1078.     when ext='.LZX' then
  1079.         address command 'lzx -q e "'arg(1)'" file_id.diz T:'
  1080.     when (ext='.LHA')|(ext='.LZH') then
  1081.         address command 'lha -q e "'arg(1)'" file_id.diz T:'
  1082.     when ext='.DMS' then
  1083.         address command 'dmsdescript >NIL: x T:file_id.diz "'arg(1)'"'
  1084.     when (ext='.TXT')|(ext='.NFO') then
  1085.         address command 'magicdiz >NIL: e "'arg(1)'" t:file_id.diz'
  1086.     otherwise
  1087.     return substr(fn,psn)
  1088. end
  1089. if ~exists('t:File_id.diz') then return substr(fn,psn,p-psn)
  1090. open(1,'t:file_Id.diz','R')
  1091. diz=readch(1,65535)
  1092. close(1)
  1093. delete('t:file_id.diz')
  1094. return strip(space(compress(diz,compress(diz,xrange(0,9)xrange('a','z')xrange('A','Z')'-@#:*& ')),1))
  1095.  
  1096. getusers: PROCEDURE;"CHANNELS";c=upper(result);if words(c)==1 then "GETUSERS";else "GETUSERS" find(c,upper(arg(1)));return result
  1097. getall: PROCEDURE
  1098. stat=arg(2);mynick=stat||getnick();nx='';tmpnx=getusers(arg(1))
  1099. do while tmpnx~=''
  1100.     parse var tmpnx nk tmpnx
  1101.     if nk=mynick then iterate
  1102.     if left(nk,1)=stat|(stat=''&pos(left(nk,1),'+@')=0) then nx=nx strip(nk,'L','+@')
  1103. end
  1104. return nx
  1105.  
  1106. wnops:
  1107. pt=wnpr
  1108. pr='WAllNOps'
  1109. st=''
  1110. signal transmit
  1111.  
  1112. wchops:
  1113. pt=wcpr
  1114. pr='WAllChOps'
  1115. st='@'
  1116.  
  1117. transmit:
  1118. if ARGS='' then do
  1119.     cecho(pr,'Usage : /'command '[TEXT]')
  1120.    exit
  1121. end
  1122. /*
  1123. x=getclip('st_wchop')
  1124. if x='' then x=1;else x=x+1
  1125. if x=3 then do
  1126.     cecho(pr,'Too many WAlls...')
  1127.     exit
  1128. end
  1129. call setclip('st_wchop',x)
  1130. */
  1131. channel=getchan()
  1132. nx=getall(channel,st)
  1133. if words(nx)=0 then do
  1134.     cecho(pr,'No one to send.')
  1135.     exit
  1136. end
  1137.  
  1138. p=pos('%c',pt)
  1139. if p~=0 then pt=insert(substr(channel,2),delstr(pt,p,2),p-1)
  1140. msg=strip(pt strip(ARGS))
  1141. cecho(pr,msg)
  1142. if x=1 then def=200;else def=1
  1143. do i=1 to words(nx)
  1144.     nk=word(nx,i)
  1145.     notice(nk,msg)
  1146. end
  1147. cecho(pr,'Done')
  1148. exit
  1149.